; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis
; 
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
; 
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
; GNU General Public License for more details.
; 
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;
; Copyright (C) 2007 Kevin Payne paynekj@hotmail.com
;
; Version 0.1 05.06.2009 First Go

(define selffilename "\n- kp24_process_negs.scm")

; this is the main routine
(define (script-fu-kp24_process_negs aimg adraw)
  (let* ((theImage aimg)
         (theLayer adraw)
         (imgList 0)
         (greenImage 0)
         (greenDrawable 0)
         )
     ; create a new image from the green channel (as this has least noise)
     (set! greenImage (car (plug-in-decompose 1 theImage theLayer "Green" 0)))
     (set! greenDrawable (car (gimp-image-get-active-drawable greenImage)))
     
     ; turn it into a positive and make it RGB    
     (gimp-invert greenDrawable)
     (gimp-image-convert-rgb greenImage)
     
     ; show the new image
     (gimp-display-new greenImage)

; flush the display
     (gimp-displays-flush)
  )
)

(script-fu-register "script-fu-kp24_process_negs"
		    _"<Image>/Script-Fu/Kevin/Process Negatives..."
		    (string-append "Process B&W Negatives" selffilename)
		    "Kevin Payne <paynekj@hotmail.com>"
		    "Kevin Payne"
		    "05/06/2009"
		    "RGB*"
		    SF-IMAGE "Input Image" 0
		    SF-DRAWABLE "Input Drawable" 0
)
